package com.usefullc.blog.schedule;

import com.usefullc.blog.service.ArticleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author: Sampson
 * @date: 2022-07-12 11:32
 */
@Slf4j
@Component
public class ArticleSchedule {

    @Autowired
    private ArticleService articleService;

    @Scheduled(cron = "0/10 * * * * *")
    public void test(){
        log.info("schedule test");
    }


    /**
     * 文章相关动作数量任务
     */
    @Scheduled(cron = "5 0/2 * * * *")
    public void updateArticleActionNum(){
        articleService.updateActionNum();
    }
}
